/*
 * @Author: 抱着羊啃 1437670973@qq.com
 * @Date: 2025-10-27 18:47:19
 * @LastEditors: 抱着羊啃 1437670973@qq.com
 * @LastEditTime: 2025-10-27 19:53:52
 * @FilePath: \fall-guard-band\src\main\java\com\example\fall_guard_band\config\WebConfig.java
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
package com.example.fall_guard_band.config;

import com.example.fall_guard_band.interceptor.JwtTokenInterceptor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
@Slf4j
public class WebConfig implements WebMvcConfigurer {

    @Autowired
    private JwtTokenInterceptor jwtTokenInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        log.info("开始注册自定义拦截器...");
        registry.addInterceptor(jwtTokenInterceptor)
                .addPathPatterns("/**") // 指定拦截的路径模式
                .excludePathPatterns("/auth/login", "/auth/register", "/auth/reset-password", "/nursing_home/list","/sensor/data"); // 排除不需要拦截的路径
    }
}